package geom;

/**
 * This class models a circle.
 * @author Magnus Brand
 *
 */
public class Circle extends Shape {
	/**
	 * The center
	 */
	Point position;
	double radius;
	
	public Circle(Point position, double radius) {
		this.position = position;
		this.radius = radius;
	}

	@Override
	public double area() {
		return Math.pow(radius, 2) * Math.PI;
	}

	@Override
	public boolean pointInShape(Point point) {
		// Calculate distance from point to center.
		// Compare to radius
		double dist = point.distanceTo(position);
		return dist <= radius;
	}

	@Override
	public boolean pointOnEdge(Point point) {
		double dist = point.distanceTo(position);
		return dist == radius;
	}

	@Override
	public Point getPosition() {
		return position;
	}

}
